/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.chl.sasanf.crud;

import edu.chl.sasanf.jpa.nbp.Product;
import java.util.ArrayList;
import java.util.List;


/**
 *
 * @author hansena
 */
public class DatabaseMockup implements IDatabase{

    @Override
    public void create(Product product) {
        System.out.println("Product created in database!");
    }

    @Override
    public void edit(Product product) {
        System.out.println("Product edited in database!");
    }


    @Override
    public void remove(Product product) {
        System.out.println("Product removed from database!");
    }

    @Override
    public Product find(Object id) {
        return new Product("MockupProduct","MockupCat", 100.0);
    }

    @Override
    public List<Product> findAll() {

        List<Product> list = new ArrayList<Product>();
        Product p1 = new Product("MockupProduct1","MockupCat1", 100.0);
        p1.setId(new Long(10));
        Product p2 = new Product("MockupProduct2","MockupCat2", 200.0);
        p2.setId(new Long(20));
        list.add(p1);list.add(p2);
        return list;
    }

    @Override
    public List<Product> findRange(int[] range) {
        //throw new UnsupportedOperationException("Not supported yet.");
        System.out.println("A range list of products found!");
        return null;
    }

    @Override
    public int count() {
        //throw new UnsupportedOperationException("Not supported yet.");
        System.out.println("Count is counted!");
        return 0;
    }

}
